import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { ApprovalNodeService } from './approval_node.service';
import { CreateApprovalNodeDto } from './dto/create-approval_node.dto';
import { UpdateApprovalNodeDto } from './dto/update-approval_node.dto';

@Controller('approval-node')
export class ApprovalNodeController {
  constructor(private readonly approvalNodeService: ApprovalNodeService) {}

  @Post()
  create(@Body() createApprovalNodeDto: CreateApprovalNodeDto) {
    return this.approvalNodeService.create(createApprovalNodeDto);
  }

  @Get()
  findAll() {
    return this.approvalNodeService.findAll();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.approvalNodeService.findOne(id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateApprovalNodeDto: UpdateApprovalNodeDto) {
    return this.approvalNodeService.update(id, updateApprovalNodeDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.approvalNodeService.remove(id);
  }

  @Post('/save-all-nodes')
  saveAllNodes(@Body() nodes: CreateApprovalNodeDto[]){
    return this.approvalNodeService.saveAllNode(nodes)
  }
}
